<template>
<div v-show="userType" class="app-container">
    <div class="search-form-box">
        <el-form
            ref="formRef"
            :inline="true"
            :label-width="formLabelWidth"
            >
            <el-form-item
                label="年份"
            >
                <el-select v-model="queryParams.yearStr" @change="yearStrChange" placeholder="请选择年份">
                    <el-option
                        v-for="item in yearsOptions"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    </el-option>
                </el-select>
            </el-form-item>
        </el-form>
    </div>
    <div v-if="isScholarship" class="Scholarship mb8">
        <div class="Scholarship-statistics">
            <div class="Scholarship-statistics-title">
                人数统计
            </div>
            <div class="Scholarship-statistics-detail">
                <div class="Scholarship-statistics-detail-item">
                    本科人数：{{userStatisticsData.benPersonNum  || 0}}人
                </div>
                <div class="Scholarship-statistics-detail-item" style="text-align: right;">
                    专科人数：{{userStatisticsData.zhuanPersonNum  || 0}}人
                </div>
            </div>
        </div>
        <div class="Scholarship-upload">
            <div class="Scholarship-upload-title">
                上传统计
            </div>
            <div class="Scholarship-upload-detail">
                <el-row :gutter="12">
                    <el-col :span="12">
                        <el-card shadow="always">
                            <div class="Scholarship-upload-detail-title">
                                本科</div>
                            <div class="Scholarship-upload-detail-progress">
                                名额上传完成：{{userStatisticsData.personPercent  || 0}}%
                            </div>
                        </el-card>
                    </el-col>
                    <el-col :span="12">
                        <el-card shadow="always">
                            <div class="Scholarship-upload-detail-title">
                                专科</div>
                            <div class="Scholarship-upload-detail-progress">
                                名额上传完成：{{userStatisticsData.personPercent2  || 0}}%
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
            </div>
        </div>
        <div class="Scholarship-xyupload">
            <div class="Scholarship-xyupload-title">
                学院上传统计
            </div>
            <div class="Scholarship-xyupload-detail">
                <el-row :gutter="12">
                    <el-col :span="8">
                        <el-card shadow="always">
                            <div class="Scholarship-xyupload-detail-title">
                                {{userStatisticsData.completed  || 0}}个</div>
                            <div class="Scholarship-xyupload-detail-progress">
                                学院上传完成
                            </div>
                        </el-card>
                    </el-col>
                    <el-col :span="8">
                        <el-card shadow="always">
                            <div class="Scholarship-xyupload-detail-title">
                                {{userStatisticsData.partiallyCompleted || 0}}个</div>
                            <div class="Scholarship-xyupload-detail-progress">
                                学院部分上传
                            </div>
                        </el-card>
                    </el-col>
                    <el-col :span="8">
                        <el-card shadow="always">
                            <div class="Scholarship-xyupload-detail-title">
                                {{userStatisticsData.incomplete || 0}}个</div>
                            <div class="Scholarship-xyupload-detail-progress">
                                学院未上传
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
            </div>
        </div>
     </div>
     <div v-if="isSubsidy" class="mb8 Scholarship">
        <div class="Scholarship-statistics">
            <div class="Scholarship-statistics-title">
                困难生统计
            </div>
            <div class="Scholarship-statistics-detail">
                <div v-for="(item, index) in subsidyStatis" :key="item.diffName" class="Scholarship-statistics-detail-item" :class="{'textRight': index == subsidyStatis.length - 1}" >
                    {{item.diffName}}：{{item.totalNum || 0}}人
                </div>
            </div>
        </div>
        <div class="Scholarship-upload">
            <div class="Scholarship-upload-title">
                困难生上传
            </div>
            <div class="Scholarship-upload-detail">
                <el-row :gutter="12" type="flex" justify="space-between">
                    <el-col :span="12" v-for="(item) in subsidyStatis" :key="item.diffName">
                        <el-card shadow="always">
                            <div class="Scholarship-upload-detail-title">
                                {{item.diffName}}</div>
                            <div class="Scholarship-upload-detail-progress">
                                名额上传完成：{{item.appPercent || 0}}%
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
            </div>
        </div>
        <div class="Scholarship-xyupload">
            <div class="Scholarship-xyupload-title">
                学院困难生上传
            </div>
            <div class="Scholarship-xyupload-detail">
                <el-row :gutter="12">
                    <el-col :span="8" v-for="item in collegeSubsidyStatis" :key="item.uploadType">
                        <el-card shadow="always">
                            <div class="Scholarship-xyupload-detail-title">
                                {{item.collageNum}}个</div>
                            <div class="Scholarship-xyupload-detail-progress">
                                {{item.uploadType}}
                            </div>
                        </el-card>
                    </el-col>
                </el-row>
            </div>
        </div>
     </div>

     <searchForm
       :formOptions="formOptions"
       @onSearch="onSearch"
       @onReset="onReset"
       :formLabelWidth="formLabelWidth"
       v-show="showSearch"
     >
      <el-form-item label="奖学金类型:" v-if="this.userType === 'schoolScholarshipCollege' || this.userType === 'schoolScholarship'">
       <el-select v-model="typeNameList" multiple clearable placeholder="请选择" @change="typeNameArry">
         <el-option v-for="item in profession" :key="item.value" :label="item.label" :value="item.value"></el-option>
       </el-select>
  </el-form-item>
      <el-form-item label="学生类型:" v-if="this.userType === 'schoolScholarshipCollege'|| this.userType === 'schoolScholarship'">
       <el-select v-model="specialityTypeList" multiple clearable placeholder="请选择" @change="specialityTypeArray">
         <el-option v-for="dict in dict.type.bc_student_type" :key="dict.value" :label="dict.label" :value="dict.value"></el-option>
       </el-select>
  </el-form-item>
      <el-form-item label="备注:" v-if="this.userType === 'schoolScholarshipCollege'|| this.userType === 'schoolScholarship'">
       <el-input v-model="queryParams.remark" multiple clearable placeholder="请输入备注" />
  </el-form-item>
    </searchForm>
     
   
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
         <el-button
           type="primary"
           plain
           size="mini"
           @click="PlUpload"
           v-hasPermi="[ userUploadBtn ]"
         >批量上传</el-button>
       </el-col>
       <el-col :span="1.5" v-if="isSchoolScholarship || isScholarship">
          <el-button
              type="warning"
              plain
              icon="el-icon-download"
              size="mini"
              v-hasPermi="[ userExportBtn ]"
              @click="handleExport"
            >导出</el-button>
        </el-col>
        <el-col :span="1.5" v-if="isSchoolScholarship">
            <el-button
                type="danger"
                plain
                icon="el-icon-delete"
                size="mini"
                v-hasPermi="[userdelBtn]"
                @click="handlePlDelete"
                >删除</el-button
            >
        </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <el-table :data="tableData" @selection-change="handleSelectionChange" v-loading="loading">
         <template v-if="isSubsidy">
            <el-table-column label="学院" :show-overflow-tooltip="true" prop="collageName" align="center" />
            <el-table-column label="专业" :show-overflow-tooltip="true" prop="specialityName" align="center" />
            <el-table-column label="班级" :show-overflow-tooltip="true" prop="className" align="center" />
            <el-table-column label="注册号" prop="registerCode" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="学生姓名" prop="studentName" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="困难类型" prop="diffTypeName" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="金额" prop="diffMoney" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="申请书" prop="applyFileName" :show-overflow-tooltip="true" align="center">
                <template slot-scope="{row}">
                    <el-button type="text" @click="downloadApply(row.applyFileUrl, row.applyFileName)">{{row.applyFileName}}</el-button>
                </template>
            </el-table-column>
            <el-table-column label="申请书审核状态" prop="applyExamType" :show-overflow-tooltip="true" align="center">
                <template slot-scope="{row}">
                    {{row.applyExamType | applyExamTypeName()}}
                </template>
            </el-table-column>
            <el-table-column label="审核意见" prop="examRemark" :show-overflow-tooltip="true" align="center" />
         </template>
         <template v-if="isScholarship">
             <el-table-column label="学院" :show-overflow-tooltip="true" prop="collegeName" align="center" />
             <el-table-column label="专业" :show-overflow-tooltip="true" prop="specialityName" align="center" />
             <el-table-column label="班级" :show-overflow-tooltip="true" prop="className" align="center" />
             <el-table-column label="注册号" prop="registerCode" :show-overflow-tooltip="true" align="center" />
             <el-table-column label="学生姓名" prop="studentName" align="center" />
             <!-- <el-table-column
                label="国奖类型"
                align="center"
                >
                <template slot-scope="scope">
                    <span v-if="scope.row.rewardType == '1'">国家奖学金</span>
                    <span v-if="scope.row.rewardType == '2'">国家励志奖学金</span>
                </template>
            </el-table-column> -->
            <el-table-column label="金额" prop="nationMoney" :show-overflow-tooltip="true" align="center" />
         </template>
         <template v-if="isSchoolScholarship">
            <el-table-column type="selection" width="55" align="center" />
             <el-table-column label="学院" :show-overflow-tooltip="true" prop="collageName" align="center" />
             <el-table-column label="专业" :show-overflow-tooltip="true" prop="specialityName" align="center" />
             <el-table-column label="班级" :show-overflow-tooltip="true" prop="className" align="center" />
             <el-table-column label="注册号" prop="registerCode" :show-overflow-tooltip="true" align="center" />
             <!-- <el-table-column label="学生类型" prop="studentType" :show-overflow-tooltip="true" align="center">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.bc_student_type" :value="scope.row.studentType"/>
                </template>
            </el-table-column> -->
            <el-table-column label="学生类型" prop="specialityType" :show-overflow-tooltip="true" align="center">
            </el-table-column>
             <el-table-column label="学生姓名" prop="studentName" align="center" />
             <el-table-column
                label="奖学金类型"
                prop="typeName"
                align="center"
                >
            </el-table-column>
            <el-table-column label="金额" prop="bonusMoney" :show-overflow-tooltip="true" align="center" />
            <el-table-column label="备注" prop="remark" :show-overflow-tooltip="true" align="center" />
         </template>
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
                <el-button
                    size="mini"
                    type="text"
                    v-if="isSubsidy && (scope.row.applyExamType==1 || scope.row.applyExamType==3)"
                    @click="handleAudit(scope.row)"
                    v-hasPermi="['poor:user:apply']"
                >审核</el-button>
                <el-button
                    size="mini"
                    type="text"
                    v-hasPermi="[usereditBtn]"
                    @click="handleUpdate(scope.row)"
                >修改</el-button>
                <el-button
                    size="mini"
                    type="text"
                    v-hasPermi="[userdelBtn]"
                    @click="handleDelete(scope.row)"
                >删除</el-button>
             </template>
         </el-table-column>
     </el-table>
     <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
        @pagination="getList" />
     <UploadFile ref="uploadFileRef" :yearStr="yearStr" @onSearch="onSearch"></UploadFile>
     <UserEdit ref="userEditRef" :collegeList="collegeList" :subsidyType="subsidyType" @onSearch="onSearch"></UserEdit>
     <AuditDlg ref="auditDlgRef" @onSearch="onSearch"></AuditDlg>
</div>
</template>
 
 <script>
 import searchForm from "@/components/Search/searchForm.vue";
 import UserEdit from "./modules/userEdit.vue";
 import AuditDlg from "./modules/auditDlg.vue";
 import UploadFile from "@/views/poorStudent-scholarship/plan/modules/uploadFile.vue";
 import { 
    getYearStrList,
    getPoorStudentYearStrList,
    poorStudentList,
    getSchoolScholarshipYear,
    getSchoolScholarshipTypes
  } from "@/api/poorStudent-scholarship/plan.js";
  import { collegeSelect } from "@/api/information/studentInfor";
 import { 
     statisticsScholarshipUser,
     scholarshipUserList,
     removeScholarshipUser,
     removePoorStudentUser,
     poorStudentStatis,
     poorStudentUserList,
     schoolScholarshipUserList,
     schoolScholarshipUserDel,
     schoolScholarshipUserPlDel
  } from "@/api/poorStudent-scholarship/user.js";

    import {
        scholarshipTypeArr
    } from "@/views/poorStudent-scholarship/dict.js"
  import {mapState} from 'vuex'
  import { getDicts } from "@/api/system/dict/type";
 export default {
     name:"allocationManagement",
     components: { 
        searchForm,
        UploadFile,
        UserEdit,
        AuditDlg
     },
     dicts: ['bc_student_type'],
     data () {
         return{
             formLabelWidth: "80px",
             // 显示搜索条件
             showSearch: true,
             // 总条数
             total: 0,
             tableData: [],
             typeNameList: [],
             specialityTypeList: [],
             // 遮罩层
             loading: false,
             queryParams:{
                pageNum: 1,
                pageSize: 10,
                // typeName: [],
                // specialityType:[]
             },
             yearStr:'',
             yearsOptions:[],
             userStatisticsData:{},
             subsidyStatis:[],
             collegeSubsidyStatis:[],
             formOptions:[],
             collegeList:[],
             subsidyType:[],
             total: 0,
             selectData: [],
             profession:[],
             scholarshipTypeArr
         }
     },
     computed:{
        ...mapState({
            userInfo: state => state.user.userInfor
        }),
         userType () {
             return this.$route.params && this.$route.params.type
         },
         isSubsidy(){
             return this.userType === 'subsidy'
         },
         isScholarship(){
            return this.scholarshipTypeArr.some((item) => {
                return item.code == this.userType 
            })
         },
         scholarshipType() {
            const scholarshipTypeItem = this.scholarshipTypeArr.find((item) => {
                return item.code == this.userType 
            })
            if (scholarshipTypeItem) {
                return scholarshipTypeItem.typeId
            } else {
                return 0
            }
         },
         isSchoolScholarship(){
            return this.userType.includes("schoolScholarship")
        },

        userUploadBtn(){
            if (this.isSubsidy) {
                return 'poor:user:upload'
            }
            if (this.isScholarship) {
                return `${this.userType}:user:upload`
            }
            if (this.userType === 'schoolScholarship') {
                return 'schoolScholarship:user:upload'
            }
            if (this.userType === 'schoolScholarshipCollege') {
                return 'schoolScholarshipCollege:user:upload'
            }
        },
        userExportBtn(){
            if (this.userType === 'schoolScholarship') {
                return 'schoolScholarship:user:export'
            }
            if (this.userType === 'schoolScholarshipCollege') {
                return 'schoolScholarshipCollege:user:export'
            }
            if (this.isScholarship) {
                return `${this.userType}:user:export`
            }
        },
        usereditBtn(){
            if (this.isSubsidy) {
                return 'poor:user:edit'
            }
            if (this.isScholarship) {
                return `${this.userType}:user:edit`
            }
            if (this.userType === 'schoolScholarship') {
                return 'schoolScholarship:user:edit'
            }
            if (this.userType === 'schoolScholarshipCollege') {
                return 'schoolScholarshipCollege:user:edit'
            }
        },
        userdelBtn(){
            if (this.isSubsidy) {
                return 'poor:user:del'
            }
            if (this.isScholarship) {
                return `${this.userType}:user:del`
            }
            if (this.userType === 'schoolScholarship') {
                return 'schoolScholarship:user:del'
            }
            if (this.userType === 'schoolScholarshipCollege') {
                return 'schoolScholarshipCollege:user:del'
            }
        }
     },
     created(){
        this.getYear()
        if (this.isScholarship) {
            this.getCollegeList()
        }
        if (this.isSubsidy) {
            this.formOptions = [
                {
                    label: "院系名称",
                    prop: "collegeId",
                    element: "el-select",
                    placeholder: "请选择院系",
                    options: []
                },
                {
                    label: "困难生类型",
                    prop: "diffTypeId",
                    element: "el-select",
                    placeholder: "请选择困难生类型",
                    options: []
                }
            ]
            this.getCollegeList()
        }
        if (this.isSchoolScholarship) {
            if (this.userType === 'schoolScholarshipCollege') {
                this.formOptions = [
                ]  
            } else {
                this.formOptions = [
                    {
                        label: "院系名称",
                        prop: "collageId",
                        element: "el-select",
                        placeholder: "请选择院系",
                        options: []
                    }
                ]
                // 院系名称
                this.getCollegeList()
            }
            // 学生类型
            this.getStudentType()
        }
     },
     filters: {
        applyExamTypeName(type){
            let _name = "";
            switch(type) {  
                case 0:
                    _name = "未提交"
                    break;
                case 1:
                    _name = "待审核"
                    break;
                case 2:
                    _name = "审核通过"
                    break;
                case 3:
                    _name = "审核失败"
                    break;
                case 4:
                    _name = "审核不通过"
                    break;
                default:
                    _name = ""
                    break;
            }
            return _name
        }
     },
     methods:{
        handleSelectionChange(val) {
            this.selectData = val;
        },
        /** 删除按钮操作 */
        handlePlDelete() {
            if (this.selectData.length > 0) {
                this.handleDelete({
                    ids:this.selectData.map((item) => {
                        return item.id;
                    })
                }, 'batch');
            } else {
                this.$modal.msgWarning("请选择人员");
            }
        },
        // 类型多选
    typeNameArry(data) {
      this.queryParams.typeName = data.join(",");
      console.log(this.queryParams.typeName);
    },
        // 类型多选
    specialityTypeArray(data) {
      this.queryParams.specialityType = data.join(",");
      console.log(this.queryParams.specialityType);
    },
        /** 导出按钮操作 */
        handleExport() {
            if (this.isSchoolScholarship) {
                this.download(
                    "finances/schScholarshipStuCollController/export",
                    {
                    ...this.queryParams
                    },
                    `校内奖学金人员名单_${new Date().getTime()}.xlsx`
                );
            }
            if (this.isScholarship) {
                const scholarshipTypeItem = this.scholarshipTypeArr.find((item) => {
                    return item.code == this.userType 
                })
                this.download(
                    "finances/stuScholarshipApplyController/exportAwardWinningStudent",
                    {
                        ...this.queryParams,
                        scholarshipType: scholarshipTypeItem.typeId
                    },
                    `${scholarshipTypeItem.label}人员名单_${new Date().getTime()}.xlsx`
                );
            }
        },
        downloadApply (url, filename) {
            const link = document.createElement("a");
            const body = document.querySelector("body");
            link.href = url
            link.download = filename;
            link.style.display = "none";
            body.appendChild(link);
            link.click();
            body.removeChild(link);
        },
        yearStrChange(){
            this.yearStr = this.queryParams.yearStr
            this.getTypes(this.queryParams.yearStr)
            // this.userStatistics(this.queryParams.yearStr)
            this.onSearch()
        },
        getTypes(yearStr){
            if (this.isSchoolScholarship) {
                getSchoolScholarshipTypes({
                    yearStr
                }).then((res) => {
                    // let index = 1
                    // if (this.userType === 'schoolScholarshipCollege') {
                    //     index = 0
                    // } else {
                    //     // index = 1
                    // }
                    this.profession =  res.map((item) => {
                                                        return {
                                                            label: item,
                                                            value: item
                                                        }
                                                    })
                                                //    this.profession = this.formOptions[index].options
                    this.subsidyType = res
                }).catch(() => {
                    this.formOptions[1].options = []
                })
            }
            if (this.isSubsidy) {
                poorStudentList({yearStr}).then((res) => {
                    if (res.rows && res.rows.length>0 ) {
                        const _plan = res.rows[0] || {}
                        this.subsidyType = _plan.diffTypePersonList
                        this.formOptions[1].options =   _plan.diffTypePersonList.map((item) => {
                                                        return {
                                                            label: item.diffName,
                                                            value: item.typeId
                                                        }
                                                    })
                    } else {
                        this.$modal.msgError("未找到补助计划，请前往补助计划填写当前年份计划！");
                    }
                })
            }
        },
        userStatistics(yearStr){
          
            if (this.isScholarship) {
                this.userStatisticsData = {}
                statisticsScholarshipUser({yearStr, scholarshipType:this.scholarshipType}).then((res) => {
                    this.userStatisticsData = res
                      console.log('dddd',res)
                })
            }
            if (this.isSubsidy) {
                this.subsidyStatis = []
                this.collegeSubsidyStatis = []
                poorStudentStatis({yearStr}).then((res) => {
                    const {collageStatisList, stuStatisList} = res
                    this.subsidyStatis = stuStatisList
                    this.collegeSubsidyStatis = collageStatisList && collageStatisList.reverse()
                })
            }
        },
        getYear(){
            this.subsidyType = []
            if (this.isScholarship) {
                getYearStrList({scholarshipType: this.scholarshipType}).then((res) => {
                    this.yearsOptions = res && res.map((item)=>{return {
                        label: item,
                        value: item
                    }})
                    this.queryParams.yearStr = res &&  res[0]
                    this.yearStr = res &&  res[0]
                    this.yearStrChange()
                })
            }
            if (this.isSubsidy) {
                getPoorStudentYearStrList().then((res) => {
                    this.yearsOptions = res && res.map((item)=>{return {
                        label: item,
                        value: item
                    }})
                    this.queryParams.yearStr = res &&  res[0]
                    this.yearStr = res &&  res[0]
                    this.yearStrChange()
                })
            }
            if (this.isSchoolScholarship) {
                getSchoolScholarshipYear().then((res) => {
                    this.yearsOptions = res && res.map((item)=>{return {
                        label: item,
                        value: item
                    }})
                    this.queryParams.yearStr = res &&  res[0]
                    this.yearStr = res &&  res[0]
                    this.yearStrChange()
                })
            }
        },
        getCollegeList(){
            collegeSelect().then((res) => {
                const _collegeList = res && res.data.map((item) => {
                    return {
                        value: item["deptId"],
                        label: item["deptName"],
                    }
                })
                // let typs = {}
                // if (this.isScholarship) {
                //     typs = {
                //         label: "国奖类型",
                //         prop: "rewardType",
                //         element: "el-select",
                //         placeholder: "请选择国奖类型",
                //         options:[{
                //             label: "国家奖学金",
                //             value: 1
                //         },{
                //             label: "国家励志奖学金",
                //             value: 2
                //         }]
                //     }
                // }
                if (this.isSchoolScholarship || this.isSubsidy) {
                    this.formOptions[0].options = _collegeList
                } else {
                    this.formOptions = [
                        {
                            label: "院系名称",
                            prop: "collegeId",
                            element: "el-select",
                            placeholder: "请选择院系",
                            options: _collegeList
                        },
                        // typs
                    ]
                }
                this.collegeList = _collegeList
            })
        },
        // 学生类型
        getStudentType() {
            getDicts("bc_student_type").then(res => {
                let index = 1
                if (this.userType === 'schoolScholarshipCollege') {
                    index = 1
                } else {
                    index = 2
                }
                this.formOptions[index].options = res.data.map(item => {
                    return {
                        value: item["dictLabel"],
                        label: item["dictLabel"]
                    };
                });
            });
        },
        PlUpload () {
            this.$refs.uploadFileRef.open("user" + (this.isSchoolScholarship ? 'schoolScholarship' : this.userType), {
                isSecondaryCollege: this.userType === "schoolScholarshipCollege" ? "1": "0"
            })
        },
        onSearch(val) {
            this.queryParams = Object.assign(this.queryParams, val);
            this.userStatistics(this.queryParams.yearStr)
            this.getList();
        },
        // 重置
        onReset(data) {
            this.queryParams = Object.assign(this.queryParams, data);
            this.queryParams.yearStr = this.yearStr
            this.queryParams.specialityType = ''
            this.queryParams.remark = ''
            this.typeNameList = []
            this.specialityTypeList = []
            this.queryParams.typeName = ''
            this.getList();
        },
        getList () {
            this.loading = true;
            if (this.isSubsidy) {
                poorStudentUserList(this.queryParams).then((res) => {
                    this.tableData = res.rows
                    this.total = res.total;
                    this.loading = false;
                })
            }
            if (this.isScholarship) {
                scholarshipUserList({
                    ...this.queryParams,
                    scholarshipType: this.scholarshipType
                }).then((res) => {
                    this.tableData = res.rows
                    this.total = res.total;
                    this.loading = false;
                })
            }
            if (this.isSchoolScholarship) {
                let _queryParams = {
                    ...this.queryParams,
                }
                if (this.userType === 'schoolScholarshipCollege') {
                    _queryParams.collageId = ''
                }
                schoolScholarshipUserList(_queryParams).then((res) => {
                    console.log(res,'232')
                    this.tableData = res.rows
                    this.total = res.total;
                    this.loading = false;
                })
            }
        },
        /** 修改按钮操作 */
        handleUpdate(row) {
            this.$refs.userEditRef.open(row, this.isSchoolScholarship ? 'schoolScholarship' : this.userType)
        },
        handleDelete(row, type){
            this.$modal
                .confirm('确认删除吗？')
                .then(() => {
                    if (this.isSubsidy) {
                        return removePoorStudentUser(row.id)
                    }
                    if (this.isScholarship) {
                        return removeScholarshipUser(row.id)
                    }
                    if (this.isSchoolScholarship) {
                        if (type == 'batch') {
                            return schoolScholarshipUserPlDel(row)
                        } else {
                            return schoolScholarshipUserDel(row.id)
                        }   
                    }
                })
                .then(() => {
                    this.getList();
                    this.$modal.msgSuccess("删除成功");
                })
                .catch(() => {});
        },
        handleAudit(row){
            this.$refs.auditDlgRef.open(row)
        }
     }
 }
</script>
 
<style scoped lang="scss">
.textRight{
    text-align: right;
}
.Scholarship{
    display: flex;
    &-statistics{
        width: 33%;
        height: 116px;
        overflow: hidden;
        background-color: #f8f8f9;
        padding: 5px 0;
        &-title{
            height: 30px;
            line-height: 30px;
            text-align: center;
            margin-bottom: 30px;
        }
        &-detail{
            padding: 0 30px;
            display: flex;
            align-items: center;
            &-item{
                width: 50%;
            }
        }
    }
    &-upload{
        width: 33%;
        margin: 0 10px;
        height: 116px;
        overflow: hidden;
        background-color: #f8f8f9;
        padding: 5px 0;
        &-title{
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
        &-detail{
            padding: 0 10px;
            &-title{
                text-align: center;
            }
            &-progress{
                text-align: center;
            }
            .el-card.is-always-shadow{
                height: 67px;
            }
            ::v-deep .el-card__body {
                padding: 15px 0px 20px 0px;
            }
        }
    }
    &-xyupload{
        width: 33%;
        height: 116px;
        overflow: hidden;
        background-color: #f8f8f9;
        padding: 5px 0;
        &-title{
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
        &-detail{
            padding: 0 10px;
            &-title{
                text-align: center;
            }
            &-progress{
                text-align: center;
            }
        }
    }
}
.allot{
    height: 70px;
    overflow: hidden;
    background-color: #f8f8f9;
    padding: 5px 0;
    &-title{
        height: 30px;
        line-height: 30px;
        text-align: center;
    }
    &-detail{
        padding: 0 30px;
        display: flex;
        align-items: center;
        &-item{
            width: 25%;
        }
    }
}
</style>